package com.cxh.rmsq.ui.adapter

import android.widget.TextView
import com.cxh.rmsq.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class TagAdapter(list: MutableList<String>, boo: Boolean) :
    BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_tag_dict, list) {
    var list = list
    var boo = boo
    override fun convert(holder: BaseViewHolder, item: String) {
        if (list.size == 1) {
            holder.getView<TextView>(R.id.stv_type)
                .setTextColor(context.resources.getColor(R.color.color_FF6300))
            holder.getView<TextView>(R.id.stv_type).background =
                context.resources.getDrawable(R.drawable.shape_tab1_6)
        } else if (list.size == 2) {
            when (holder.layoutPosition) {
                0 -> {
                    holder.getView<TextView>(R.id.stv_type)
                        .setTextColor(context.resources.getColor(R.color.color_FF6300))
                    holder.getView<TextView>(R.id.stv_type).background =
                        context.resources.getDrawable(R.drawable.shape_tab1_6)
                }

                1 -> {
                    holder.getView<TextView>(R.id.stv_type)
                        .setTextColor(context.resources.getColor(R.color.color_FF6161))
                    holder.getView<TextView>(R.id.stv_type).background =
                        context.resources.getDrawable(R.drawable.shape_tab2_6)
                }
            }
        } else if (list.size == 3) {
            when (holder.layoutPosition) {
                0 -> {
                    holder.getView<TextView>(R.id.stv_type)
                        .setTextColor(context.resources.getColor(R.color.color_FF6300))
                    holder.getView<TextView>(R.id.stv_type).background =
                        context.resources.getDrawable(R.drawable.shape_tab1_6)
                }

                1 -> {
                    holder.getView<TextView>(R.id.stv_type)
                        .setTextColor(context.resources.getColor(R.color.color_FF6161))
                    holder.getView<TextView>(R.id.stv_type).background =
                        context.resources.getDrawable(R.drawable.shape_tab2_6)
                }

                2 -> {
                    holder.getView<TextView>(R.id.stv_type)
                        .setTextColor(context.resources.getColor(R.color.color_00DEFF))
                    holder.getView<TextView>(R.id.stv_type).background =
                        context.resources.getDrawable(R.drawable.shape_tab3_6)
                }
            }
        }

//            if (boo) {
//                if (holder.layoutPosition == 3) {
//                    holder.getView<TextView>(R.id.stv_type)
//                        .setTextColor(resources.getColor(R.color.color_AF74DE))
//                    holder.getView<TextView>(R.id.stv_type).background =
//                        resources.getDrawable(R.drawable.shape_tab4_6)
//                }
//            }

        holder.setText(R.id.stv_type, item)

    }
}